-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Make site work with the Cloudflare OpenNext adapter #7383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Make site work with the Cloudflare OpenNext adapter #7383
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
b5e1217
to
0463451
Compare
@dario-piotrowicz do we have updates here? 👀 |
Hey @ovflowd 👋 Sorry for keeping the PR lingering, there are a few smaller issues we addressed in our adapter (that I need to reflect here), and also ISR should be coming soon (@vicb can provide more context) Besides that I just need to rebase the PR, the only significant issue remaining should be filesystem access, but I wanted to clarify that with you, I'll drop you a message today to clarify things (PS: I hope the PR is not bothering you 🙇, if you want I can close it and reopen it when we're ready?) |
This is awesome news. Excited to hear from @vicb
I believe we sorted that out on Slack 🖖
Not at all <3 |
542f172
to
2723110
Compare
2723110
to
3481f56
Compare
3481f56
to
f746d5c
Compare
f746d5c
to
4ff9d79
Compare
4ff9d79
to
fac63da
Compare
18c36ce
to
bcf71ce
Compare
update the site application so that it can be build using the Cloudflare OpenNext adapter (`@opennextjs/cloudflare`) and thus deployed on Cloudflare Workers
4589f89
to
664dc37
Compare
- `npx turbo cloudflare:preview` builds the website using the OpenNext Cloudflare adapter and runs the website locally in a server simulating the Cloudflare hosting (using the [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/)) | ||
- `npx turbo cloudflare:deploy` builds the website using the OpenNext Cloudflare adapter and deploys the website to the Cloudflare network (using the [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ovflowd I know you asked not to have Cloudflare specific commands but I feel like this might be a good initial start for this and then consolidate the deployment scripts later on when the dust is fully settled
If you strongly disagree with this I'm happy to change this and try consolidate the scripts right off the bat
PS: I'll reach out to discuss the migration process, that might also influence how we want the scripts here to look like
@@ -164,6 +165,48 @@ This repository contains several scripts and commands for performing numerous ta | |||
|
|||
</details> | |||
|
|||
## Experimental Cloudflare Deployment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've remmemerd to address #7383 (comment) 😄👍
@@ -53,6 +53,7 @@ | |||
"eslint-plugin-import-x": "~4.10.0", | |||
"eslint-plugin-no-relative-import-paths": "~1.6.1", | |||
"prettier": "3.5.3", | |||
"prettier-plugin-tailwindcss": "0.6.11" | |||
"prettier-plugin-tailwindcss": "0.6.11", | |||
"unrs-resolver": "^1.7.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the unrs-resolver
dependency fixes an issue I was hitting in CI:
Oops! Something went wrong! :(
ESLint: 9.23.0
Error: Failed to load native binding
(related: unrs/unrs-resolver#56)
I must admit that I haven't really understood what the issue is here 🤔 if anyone has any idea on how to maybe better address/investigate it I'm more than happy to look into the issue 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actively use the dep?
If not, maybe add it to overrides for now, and we can investigate further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actively use the dep?
No
If not, maybe add it to overrides for now, and we can investigate further?
Good call, yeah, sorry I keep forgetting the npm has overrides 😓
PS: I can keep investigating further but my worry is that this might just be fixed by the pnpm migration or if a solution is found for npm such can be invalidated by the pnpm migration 🤔
@ovflowd the PR should be in a good enough shape for you to have another look when you've got a minute 🙏 🙂 |
Co-authored-by: Aviv Keller <[email protected]> Signed-off-by: Dario Piotrowicz <[email protected]>
Co-authored-by: Aviv Keller <[email protected]> Signed-off-by: Dario Piotrowicz <[email protected]>
Co-authored-by: Aviv Keller <[email protected]> Signed-off-by: Dario Piotrowicz <[email protected]>
"dev": "npm run build-blog-data:watch & sleep 1 && cross-env NODE_NO_WARNINGS=1 next dev", | ||
"serve": "npm run build-blog-data:watch & sleep 1 && npm run dev", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this running the build twice? Once for serve, and again when serve calls dev?
This PR applies changes to make it so that the site can be deployed to Cloudflare workers using the open-next Cloudflare adapter
The app does seem to work as intended for the most part:

Deployment URL: https://nodejs-website.web-experiments.workers.dev
Warning
The PR is currently a single commit (ish), I am planning to force push (with
--force-with-lease
) any new changes and keep this a single commit PR for now (so that it's easier to manage and rebase), if that's too annoying problematic for reviewers please let me know and I can just push standard commits if strongly preferredCheck List
npm run format
to ensure the code follows the style guide.npm run test
to check if all tests are passing.npx turbo build
to check if the website builds without errors.